package propertymgmt.gui;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JFormattedTextField;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;

import propertymgmt.constants.Constants.PaymentType;
import propertymgmt.entities.Lease;
import propertymgmt.entities.Payment;
import propertymgmt.entities.Property;
import propertymgmt.entities.Tenant;
import propertymgmt.main.Main;
import propertymgmt.util.PropertiesManager;
import propertymgmt.util.WindowUtils;

/**
 * BrowseModifyProperty.java
 * 
 * GUI allowing the user to browse and/or modify currently existing
 * Property objects.
 * 
 * @author Brian
 */
@SuppressWarnings("serial")
public class BrowseModifyProperty extends javax.swing.JInternalFrame {
	
    /** Creates new form OpenModifyProperty */
    public BrowseModifyProperty() {
        initComponents();
        tabbedPane.setEnabledAt(1, false);
        tabbedPane.setEnabledAt(2, false);
        tabbedPane.setEnabledAt(3, false);
        loadProperties();
    }
    
    private String getPropertyName(){
    	return txt_propertyName.getText().trim();
    }
    
    private String getPropertyAddress(){
    	return txt_propertyAddress.getText().trim();
    }
    
    private double getSquareFeet(){
    	if(ftxt_squareFeet.getText().trim().isEmpty()) return 0;
    	return Double.parseDouble(ftxt_squareFeet.getText().trim());
    }
    
    private int getNumRooms(){
    	if(ftxt_numRooms.getText().trim().isEmpty()) return 0;
    	return Integer.parseInt(ftxt_numRooms.getText().trim());
    }
    
    private int getNumBaths(){
    	if(ftxt_numBaths.getText().trim().isEmpty()) return 0;
    	return Integer.parseInt(ftxt_numBaths.getText().trim());
    }
    
    private int getNumHalfBaths(){
    	if(ftxt_numHalfBaths.getText().trim().isEmpty()) return 0;
    	return Integer.parseInt(ftxt_numHalfBaths.getText().trim());
    }
    
    private String getExtraInfo(){
    	return jtxt_extraInfo.getText().trim();
    }
    
    private double getDepositAmount(){
    	if(ftxt_depositAmt.getText().trim().isEmpty()) return 0;
    	return Double.parseDouble(ftxt_depositAmt.getText().trim());
    }
    
    private double getRentAmount(){
    	if(ftxt_rentAmt.getText().trim().isEmpty()) return 0;
    	return Double.parseDouble(ftxt_rentAmt.getText().trim());
    }
    
    private int getRentDueDate(){
    	return Integer.parseInt(spn_rentDueDate.getValue().toString());
    }
    
    private int getRentLateDate(){
    	return Integer.parseInt(spn_rentLateDate.getValue().toString());
    }
    
    private double getLateRentFee(){
    	if(ftxt_lateRentFee.getText().trim().isEmpty()) return 0;
    	return Double.parseDouble(ftxt_lateRentFee.getText().trim());
    }
    
    private double getLateRentFeePerDay(){
    	if(ftxt_lateRentFeePerDay.getText().trim().isEmpty()) return 0;
    	return Double.parseDouble(ftxt_lateRentFeePerDay.getText().trim());
    }
    
    private boolean isPetsAllowed(){
    	return chk_petsAllowed.isSelected();
    }
    
    private double getPetDepositFee(){
    	if(ftxt_petDepositAmt.getText().trim().isEmpty()) return 0;
    	return Double.parseDouble(ftxt_petDepositAmt.getText().trim());
    }
    
    private boolean isPetDepositRefundable(){
    	return chk_petDepositRefundable.isSelected();
    }
    
    private String getFirstName(){
    	return txt_firstName.getText().trim();
    }
    
    private String getLastName(){
    	return txt_lastName.getText().trim();
    }
    
    private int getAge(){
    	if(ftxt_age.getText().trim().isEmpty()) return 0;
    	return Integer.parseInt(ftxt_age.getText().trim());
    }
    
    public PaymentType getPaymentType(){
    	return (PaymentType) cmbo_paymentType.getSelectedItem();
    }
    
    private String getPaymentName(){
    	return txt_paymentName.getText().trim();
    }
    
    private double getAmount(){
    	if(ftxt_amount.getText().trim().isEmpty()) return 0;
    	return Double.parseDouble(ftxt_amount.getText().trim());
    }
    
    private Date getDateReceived(){
    	return dc_dateReceived.getDate();
    }
    
    private ArrayList<Tenant> getAssociatedTenants(){
    	ArrayList<Tenant> tenants = new ArrayList<Tenant>();
    	
    	int numTenants = ((DefaultListModel<Tenant>)list_associatedTenants.getModel()).getSize();
    	
    	for(int i = 0; i < numTenants; i++){
    		tenants.add((Tenant) ((DefaultListModel<Tenant>)list_associatedTenants.getModel()).getElementAt(i));
    	}
    	
    	return tenants;
    }
    
    private String getNewTenantFirstName(){
    	return txt_newTenantFirstName.getText().trim();
    }
    
    private String getNewTenantLastName(){
    	return txt_newTenantLastName.getText().trim();
    }
    
    private int getNewTenantAge(){
    	if(txt_newTenantAge.getText().trim().isEmpty()) return 0;
    	return Integer.parseInt(txt_newTenantAge.getText().trim());
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {

        tabbedPane = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        list_properties = new javax.swing.JList<Property>();
        list_properties.setModel(new DefaultListModel<Property>());
        jPanel3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txt_propertyAddress = new javax.swing.JTextField();
        txt_propertyName = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jtxt_extraInfo = new javax.swing.JTextArea();
        ftxt_numHalfBaths = new javax.swing.JFormattedTextField();
        ftxt_squareFeet = new javax.swing.JFormattedTextField();
        ftxt_numRooms = new javax.swing.JFormattedTextField();
        ftxt_numBaths = new javax.swing.JFormattedTextField();
        btn_savePropertyChanges = new javax.swing.JButton();
        btn_deleteProperty = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        list_leases = new javax.swing.JList<Lease>();
        list_leases.setModel(new DefaultListModel<Lease>());
        jPanel7 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        dc_leaseEndDate = new com.toedter.calendar.JDateChooser();
        dc_leaseStartDate = new com.toedter.calendar.JDateChooser();
        ftxt_rentAmt = new javax.swing.JFormattedTextField();
        ftxt_depositAmt = new javax.swing.JFormattedTextField();
        spn_rentDueDate = new javax.swing.JSpinner();
        spn_rentLateDate = new javax.swing.JSpinner();
        ftxt_lateRentFeePerDay = new javax.swing.JFormattedTextField();
        ftxt_lateRentFee = new javax.swing.JFormattedTextField();
        chk_petsAllowed = new javax.swing.JCheckBox();
        jLabel15 = new javax.swing.JLabel();
        ftxt_petDepositAmt = new javax.swing.JFormattedTextField();
        chk_petDepositRefundable = new javax.swing.JCheckBox();
        btn_saveLeaseChanges = new javax.swing.JButton();
        btn_deleteLease = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        list_tenants = new javax.swing.JList<Tenant>();
        list_tenants.setModel(new DefaultListModel<Tenant>());
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        txt_lastName = new javax.swing.JTextField();
        txt_firstName = new javax.swing.JTextField();
        ftxt_age = new javax.swing.JFormattedTextField();
        jPanel13 = new javax.swing.JPanel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        txt_newTenantAge = new javax.swing.JFormattedTextField();
        txt_newTenantLastName = new javax.swing.JTextField();
        txt_newTenantFirstName = new javax.swing.JTextField();
        btn_createNewTenant = new javax.swing.JButton();
        btn_saveTenantChanges = new javax.swing.JButton();
        btn_deleteTenant = new javax.swing.JButton();
        jPanel10 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        list_payments = new javax.swing.JList<Payment>();
        list_payments.setModel(new DefaultListModel<Payment>());
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        txt_paymentName = new javax.swing.JTextField();
        ftxt_amount = new javax.swing.JFormattedTextField();
        jLabel22 = new javax.swing.JLabel();
        dc_dateReceived = new com.toedter.calendar.JDateChooser();
        jPanel12 = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        list_associatedTenants = new javax.swing.JList<Tenant>();
        list_associatedTenants.setModel(new DefaultListModel<Tenant>());
        btn_addTenant = new javax.swing.JButton();
        btn_removeTenant = new javax.swing.JButton();
        jScrollPane7 = new javax.swing.JScrollPane();
        list_paymentTenants = new javax.swing.JList<Tenant>();
        list_paymentTenants.setModel(new DefaultListModel<Tenant>());
        cmbo_paymentType = new javax.swing.JComboBox<PaymentType>();
        rentMonthChooser = new com.toedter.calendar.JMonthChooser();
        rentMonthChooser.setVisible(false);
        cmbo_rentYear = new javax.swing.JComboBox<Integer>();
        cmbo_rentYear.setVisible(false);
        btn_deletePayment = new javax.swing.JButton();
        btn_savePaymentChanges = new javax.swing.JButton();
        btn_close = new javax.swing.JButton();
        
        txt_propertyName.setHorizontalAlignment(JTextField.CENTER);
        txt_propertyAddress.setHorizontalAlignment(JTextField.CENTER);
        ftxt_squareFeet.setHorizontalAlignment(JFormattedTextField.CENTER);
        ftxt_numRooms.setHorizontalAlignment(JFormattedTextField.CENTER);
        ftxt_numBaths.setHorizontalAlignment(JFormattedTextField.CENTER);
        ftxt_numHalfBaths.setHorizontalAlignment(JFormattedTextField.CENTER);
        
        spn_rentDueDate.setModel(new SpinnerNumberModel(1, 1, 31, 1));
        spn_rentLateDate.setModel(new SpinnerNumberModel(1, 1, 31, 1));

        setClosable(true);
        setIconifiable(true);
        setTitle("Browse / Modify Properties");

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Properties", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        list_properties.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        list_properties.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                list_propertiesValueChanged(evt);
            }
        });
        list_properties.addMouseListener(new MouseAdapter() {
        	public void mouseClicked(MouseEvent e){
        		list_propertiesMouseCliked(e);
        	}
		});
        jScrollPane1.setViewportView(list_properties);

        jPanel2.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 180, 410));

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Property Information", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel1.setText("Property Name");
        jPanel3.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1));

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel2.setText("Property Address");
        jPanel3.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, -1, -1));

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel3.setText("Square Feet");
        jPanel3.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, -1, -1));

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel4.setText("Number of Rooms");
        jPanel3.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 150, -1, -1));

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel5.setText("Number of Bathrooms");
        jPanel3.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 190, -1, -1));

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel6.setText("Number of Half Bathrooms");
        jPanel3.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 230, -1, -1));
        jPanel3.add(txt_propertyAddress, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 70, 440, -1));
        jPanel3.add(txt_propertyName, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 30, 440, -1));

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Extra Information", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jScrollPane4.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

        jtxt_extraInfo.setColumns(20);
        jtxt_extraInfo.setRows(5);
        jtxt_extraInfo.setWrapStyleWord(true);
        jScrollPane4.setViewportView(jtxt_extraInfo);

        jPanel4.add(jScrollPane4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 630, 130));

        jPanel3.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 270, 650, 160));

        ftxt_numHalfBaths.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("###"))));
        jPanel3.add(ftxt_numHalfBaths, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 230, 440, -1));

        ftxt_squareFeet.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("###0.##"))));
        jPanel3.add(ftxt_squareFeet, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 110, 440, -1));

        ftxt_numRooms.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("###"))));
        jPanel3.add(ftxt_numRooms, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 150, 440, -1));

        ftxt_numBaths.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("###"))));
        jPanel3.add(ftxt_numBaths, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 190, 440, -1));

        btn_savePropertyChanges.setText("Save Changes");
        btn_savePropertyChanges.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_savePropertyChangesActionPerformed(evt);
            }
        });

        btn_deleteProperty.setText("Delete Property");
        btn_deleteProperty.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_deletePropertyActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(20, 20, 20)
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 693, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(btn_deleteProperty)
                        .addGap(18, 18, 18)
                        .addComponent(btn_savePropertyChanges)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_savePropertyChanges)
                    .addComponent(btn_deleteProperty))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        tabbedPane.addTab("Properties", jPanel1);

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Leases", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel6.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        list_leases.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        list_leases.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                list_leasesValueChanged(evt);
            }
        });
        jScrollPane2.setViewportView(list_leases);

        jPanel6.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 180, 410));

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Lease Information", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel7.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel7.setText("Late Rent Fee Per Day");
        jLabel7.setToolTipText("A fee for every day that the rent is late");
        jPanel7.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 310, -1, -1));

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel8.setText("Lease Start Date");
        jPanel7.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1));

        jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel9.setText("Lease End Date");
        jPanel7.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, -1, -1));

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel10.setText("Deposit Amount");
        jPanel7.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, -1, -1));

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel11.setText("Rent Amount");
        jPanel7.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 150, -1, -1));

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel12.setText("Day of Month Rent Is Due");
        jPanel7.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 190, -1, -1));

        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel13.setText("Day of Month Rent Is Late");
        jPanel7.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 230, -1, -1));

        jLabel14.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel14.setText("Late Rent Fee");
        jLabel14.setToolTipText("A flat fee just for being late");
        jPanel7.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 270, -1, -1));
        jPanel7.add(dc_leaseEndDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 70, 230, -1));
        jPanel7.add(dc_leaseStartDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 30, 230, -1));
        jPanel7.add(ftxt_rentAmt, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 150, 110, -1));
        jPanel7.add(ftxt_depositAmt, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 110, 110, -1));
        jPanel7.add(spn_rentDueDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 190, 40, -1));
        jPanel7.add(spn_rentLateDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 230, 40, -1));

        ftxt_lateRentFeePerDay.setToolTipText("A fee for every day that the rent is late");
        jPanel7.add(ftxt_lateRentFeePerDay, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 310, 110, -1));

        ftxt_lateRentFee.setToolTipText("A flat fee just for being late");
        jPanel7.add(ftxt_lateRentFee, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 270, 110, -1));

        chk_petsAllowed.setFont(new java.awt.Font("Tahoma", 1, 11));
        chk_petsAllowed.setText("Pets Allowed");
        chk_petsAllowed.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chk_petsAllowedActionPerformed(evt);
            }
        });
        jPanel7.add(chk_petsAllowed, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 350, -1, -1));

        jLabel15.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel15.setText("Pet Deposit Fee");
        jLabel15.setEnabled(false);
        jPanel7.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 360, -1, -1));

        ftxt_petDepositAmt.setEnabled(false);
        jPanel7.add(ftxt_petDepositAmt, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 360, 110, -1));

        chk_petDepositRefundable.setFont(new java.awt.Font("Tahoma", 1, 11));
        chk_petDepositRefundable.setText("Pet Deposit Refundable");
        chk_petDepositRefundable.setEnabled(false);
        jPanel7.add(chk_petDepositRefundable, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 390, -1, -1));

        btn_saveLeaseChanges.setText("Save Changes");
        btn_saveLeaseChanges.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_saveLeaseChangesActionPerformed(evt);
            }
        });

        btn_deleteLease.setText("Delete Lease");
        btn_deleteLease.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_deleteLeaseActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(20, 20, 20)
                        .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, 693, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addComponent(btn_deleteLease)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btn_saveLeaseChanges)))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(11, 11, 11)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_saveLeaseChanges)
                    .addComponent(btn_deleteLease))
                .addContainerGap(16, Short.MAX_VALUE))
        );

        tabbedPane.addTab("Leases", jPanel5);

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tenants", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel9.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        list_tenants.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        list_tenants.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                list_tenantsValueChanged(evt);
            }
        });
        jScrollPane3.setViewportView(list_tenants);

        jPanel9.add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 200, 410));

        jLabel16.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel16.setText("Age");
        jPanel9.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 110, -1, -1));

        jLabel17.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel17.setText("First Name");
        jPanel9.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 30, -1, -1));

        jLabel18.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel18.setText("Last Name");
        jPanel9.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 70, -1, -1));
        jPanel9.add(txt_lastName, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 70, 320, -1));
        jPanel9.add(txt_firstName, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 30, 320, -1));

        ftxt_age.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("###"))));
        jPanel9.add(ftxt_age, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 110, 110, -1));

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Create New Tenant", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel13.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel23.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel23.setText("First Name");
        jPanel13.add(jLabel23, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 60, -1, -1));

        jLabel24.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel24.setText("Last Name");
        jPanel13.add(jLabel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 100, -1, -1));

        jLabel25.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel25.setText("Age");
        jPanel13.add(jLabel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 140, -1, -1));

        txt_newTenantAge.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("###"))));
        jPanel13.add(txt_newTenantAge, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 140, 110, -1));
        jPanel13.add(txt_newTenantLastName, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 100, 320, -1));
        jPanel13.add(txt_newTenantFirstName, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 60, 320, -1));

        btn_createNewTenant.setText("Create New Tenant");
        btn_createNewTenant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_createNewTenantActionPerformed(evt);
            }
        });
        jPanel13.add(btn_createNewTenant, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 200, -1, -1));

        jPanel9.add(jPanel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 170, 650, 240));

        btn_saveTenantChanges.setText("Save Changes");
        btn_saveTenantChanges.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_saveTenantChangesActionPerformed(evt);
            }
        });

        btn_deleteTenant.setText("Delete Tenant");
        btn_deleteTenant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_deleteTenantActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, 913, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                        .addComponent(btn_deleteTenant)
                        .addGap(18, 18, 18)
                        .addComponent(btn_saveTenantChanges)))
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 436, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_saveTenantChanges)
                    .addComponent(btn_deleteTenant))
                .addContainerGap(17, Short.MAX_VALUE))
        );

        tabbedPane.addTab("Tenants", jPanel8);

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Payments", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel11.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        list_payments.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        list_payments.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                list_paymentsValueChanged(evt);
            }
        });
        jScrollPane5.setViewportView(list_payments);

        jPanel11.add(jScrollPane5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 200, 410));

        jLabel19.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel19.setText("Date");
        jPanel11.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 110, -1, -1));

        jLabel20.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel20.setText("Type");
        jPanel11.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 30, -1, -1));

        jLabel21.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel21.setText("Name");
        jPanel11.add(jLabel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 70, -1, -1));
        jPanel11.add(txt_paymentName, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 70, 320, -1));

        ftxt_amount.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("###"))));
        jPanel11.add(ftxt_amount, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 110, 110, -1));

        jLabel22.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel22.setText("Amount");
        jPanel11.add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 110, -1, -1));
        jPanel11.add(dc_dateReceived, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 110, 180, -1));

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tenant(s) Associated With Payment", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
        jPanel12.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        list_associatedTenants.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                list_associatedTenantsValueChanged(evt);
            }
        });
        jScrollPane6.setViewportView(list_associatedTenants);

        jPanel12.add(jScrollPane6, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 20, 170, 210));

        btn_addTenant.setText(">>");
        btn_addTenant.setEnabled(false);
        btn_addTenant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_addTenantActionPerformed(evt);
            }
        });
        jPanel12.add(btn_addTenant, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 50, 60, -1));

        btn_removeTenant.setText("<<");
        btn_removeTenant.setEnabled(false);
        btn_removeTenant.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_removeTenantActionPerformed(evt);
            }
        });
        jPanel12.add(btn_removeTenant, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 90, 60, -1));

        list_paymentTenants.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                list_paymentTenantsValueChanged(evt);
            }
        });
        jScrollPane7.setViewportView(list_paymentTenants);

        jPanel12.add(jScrollPane7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 170, 210));

        jPanel11.add(jPanel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 160, 440, 250));
        
        cmbo_paymentType.setModel(new DefaultComboBoxModel<PaymentType>());
        cmbo_paymentType.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cmbo_paymentTypeItemStateChanged(evt);
            }
        });
        
        for(PaymentType paymentType : PaymentType.values()){
        	((DefaultComboBoxModel<PaymentType>)cmbo_paymentType.getModel()).addElement(paymentType);
        }
        jPanel11.add(cmbo_paymentType, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 30, 200, -1));
        jPanel11.add(rentMonthChooser, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 30, 130, 20));
        
        for(int i = 1990; i <= Calendar.getInstance().get(Calendar.YEAR); i++){
        	((DefaultComboBoxModel<Integer>) cmbo_rentYear.getModel()).addElement(i);
        }
        
        jPanel11.add(cmbo_rentYear, new org.netbeans.lib.awtextra.AbsoluteConstraints(720, 30, 70, 20));
        
        btn_deletePayment.setText("Delete Payment");
        btn_deletePayment.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_deletePaymentActionPerformed(evt);
            }
        });

        btn_savePaymentChanges.setText("Save Changes");
        btn_savePaymentChanges.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_savePaymentChangesActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(695, Short.MAX_VALUE)
                .addComponent(btn_deletePayment)
                .addGap(18, 18, 18)
                .addComponent(btn_savePaymentChanges)
                .addContainerGap())
            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, 913, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(464, Short.MAX_VALUE)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_savePaymentChanges)
                    .addComponent(btn_deletePayment))
                .addContainerGap())
            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 437, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(50, Short.MAX_VALUE)))
        );

        tabbedPane.addTab("Payments", jPanel10);

        btn_close.setText("Close");
        btn_close.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_closeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(tabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(858, Short.MAX_VALUE)
                .addComponent(btn_close, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(tabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 526, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btn_close)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>
    
    private void cmbo_paymentTypeItemStateChanged(java.awt.event.ItemEvent evt) {
    	Object paymentTypeObj = cmbo_paymentType.getSelectedItem();
    	
    	if(paymentTypeObj != null){
    		PaymentType paymentType = (PaymentType) paymentTypeObj;
    		
    		boolean visible = paymentType.equals(PaymentType.RENT);
    		rentMonthChooser.setVisible(visible);
    		cmbo_rentYear.setVisible(visible);
    	}
    }

    private void chk_petsAllowedActionPerformed(java.awt.event.ActionEvent evt) {
        jLabel15.setEnabled(chk_petsAllowed.isSelected());
        ftxt_petDepositAmt.setEnabled(chk_petsAllowed.isSelected());
        chk_petDepositRefundable.setEnabled(chk_petsAllowed.isSelected());
    }
    
    private void list_propertiesValueChanged(javax.swing.event.ListSelectionEvent evt) {
    	if(evt.getValueIsAdjusting() == false){
    		Property currentProperty = getCurrentChosenProperty();
    		
    		if(currentProperty != null){
    			clearPropertiesFields();
    			clearLeases();
    			clearLeaseFields();
    			tabbedPane.setEnabledAt(1, false);
    			clearTenants();
    			clearTenantFields();
    			tabbedPane.setEnabledAt(2, false);
    			clearPayments();
    			clearPaymentFields();
    			clearPaymentAssociatedTenants();
    			tabbedPane.setEnabledAt(3, false);
    			loadPropertyFields();
    			
    			if(currentProperty.getLeases().size() != 0){
    				loadLeases();
    				tabbedPane.setEnabledAt(1, true);
    			}
    		}
    	}
    }

    private void list_propertiesMouseCliked(MouseEvent e){
    	if(e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2){
    		displayPropertyImage();
    	}
    }
    
    private void displayPropertyImage(){
    	Property currentProperty = getCurrentChosenProperty();
    	
    	if(currentProperty != null){
    		PropertyImageFrame pif = new PropertyImageFrame(currentProperty);
    		pif.setVisible(true);
    		Main.propertyMgr.getTheDesktop().add(pif);
    		pif.moveToFront();
    		WindowUtils.centerWithinParent(pif, Main.propertyMgr.getTheDesktop());
    	}
    }
    
    private void list_leasesValueChanged(javax.swing.event.ListSelectionEvent evt) {
    	if(evt.getValueIsAdjusting() == false){
    		Lease currentLease = getCurrentChosenLease();
    		
    		if(currentLease != null){
    			clearLeaseFields();
    	    	dc_leaseStartDate.setDate(currentLease.getLeaseStartDate());
    	    	dc_leaseEndDate.setDate(currentLease.getLeaseEndDate());
    	    	ftxt_depositAmt.setText(String.valueOf(currentLease.getDepositAmount()));
    	    	ftxt_rentAmt.setText(String.valueOf(currentLease.getRentAmount()));
    	    	spn_rentDueDate.setValue(currentLease.getRentDueDate());
    	    	spn_rentLateDate.setValue(currentLease.getRentLateDate());
    	    	ftxt_lateRentFee.setText(String.valueOf(currentLease.getLateRentFee()));
    	    	ftxt_lateRentFeePerDay.setText(String.valueOf(currentLease.getLateRentFeePerDay()));
    	    	chk_petsAllowed.setSelected(currentLease.isPetsAllowed());
    	    	
    	    	if(chk_petsAllowed.isSelected()){
    	    		jLabel15.setEnabled(true);
    	    		ftxt_petDepositAmt.setEnabled(true);
    	    		chk_petDepositRefundable.setEnabled(true);
    	    		ftxt_petDepositAmt.setText(String.valueOf(currentLease.getPetDepositFee()));
    	    		chk_petDepositRefundable.setSelected(currentLease.isPetDepositRefundable());
    	    	}
    			
    	    	tabbedPane.setEnabledAt(2, currentLease.getTenants().size() != 0);
    	    	tabbedPane.setEnabledAt(3, currentLease.getTenants().size() != 0);
    			
    			loadTenants();
    			loadPayments();
    		}
    	}
    }
    
    private void list_paymentsValueChanged(javax.swing.event.ListSelectionEvent evt) {
    	if(evt.getValueIsAdjusting() == false){
    		
    		Lease currentLease = getCurrentChosenLease();
    		
    		if(currentLease != null){
	    		// clear list_paymentTenants
	    		((DefaultListModel<Tenant>)list_paymentTenants.getModel()).clear();
	    		
	    		// reload list_paymentTenants
	    		if(currentLease.getPayments().size() > 0){
	    			for(Tenant tenant : currentLease.getTenants()){
	    				((DefaultListModel<Tenant>)list_paymentTenants.getModel()).addElement(tenant);
	    			}
	    		}
	    		
	    		// clear list_associatedTenants
	        	((DefaultListModel<Tenant>)list_associatedTenants.getModel()).clear();
	        	
	    		loadPaymentFields();
    		}
    	}
    }

    private void list_tenantsValueChanged(javax.swing.event.ListSelectionEvent evt) {
    	if(evt.getValueIsAdjusting() == false){
    		Tenant currentTenant = getCurrentChosenTenant();
    		
    		if(currentTenant != null){
    	    	txt_firstName.setText(currentTenant.getFirstName());
    	    	txt_lastName.setText(currentTenant.getLastName());
    	    	ftxt_age.setText(String.valueOf(currentTenant.getTenantAge()));
    		}
    	}
    }
    
    private void list_associatedTenantsValueChanged(javax.swing.event.ListSelectionEvent evt) {
    	if(evt.getValueIsAdjusting() == false){
    		btn_removeTenant.setEnabled(true);
    	}
    }
    
    private void list_paymentTenantsValueChanged(javax.swing.event.ListSelectionEvent evt) {
    	if(evt.getValueIsAdjusting() == false){
    		btn_addTenant.setEnabled(true);
    	}
    }
    
    private void btn_closeActionPerformed(java.awt.event.ActionEvent evt) {
        dispose();
    }
    
    private void btn_createNewTenantActionPerformed(java.awt.event.ActionEvent evt) {
    	if(checkNewTenantFields()){
    		Lease currentLease = getCurrentChosenLease();
    		
    		if(currentLease != null){
	    		Tenant newTenant = new Tenant(getNewTenantFirstName(), getNewTenantLastName(), getNewTenantAge());
	    		currentLease.addTenant(newTenant);
	    		newTenant.setLease(currentLease);
	    		loadTenants();
	    		clearNewTenantFields();
    		}
    	}
    }
    
    private void clearNewTenantFields(){
    	txt_newTenantFirstName.setText(null);
    	txt_newTenantLastName.setText(null);
    	txt_newTenantAge.setText(null);
    	txt_newTenantFirstName.requestFocus();
    }
    
    private boolean checkNewTenantFields(){
    	boolean passed = !txt_newTenantFirstName.getText().trim().isEmpty();
    	passed &= !txt_newTenantLastName.getText().trim().isEmpty();
    	
    	return passed;
    }

    private void btn_deletePropertyActionPerformed(java.awt.event.ActionEvent evt) {
    	Property currentProperty = getCurrentChosenProperty();
    	
    	if(currentProperty != null){
    		String msg = "Really delete property " + currentProperty.getPropertyName() + "?";
        	String title = "Really delete property?";
        	int reply = JOptionPane.showConfirmDialog(this, msg, title, JOptionPane.YES_NO_OPTION);
        	if(reply == JOptionPane.YES_OPTION){
        		PropertiesManager.getInstance().removePropertyFromDB(currentProperty);
        		loadProperties();
        	}
    	}
    }
    
    private void btn_deleteLeaseActionPerformed(java.awt.event.ActionEvent evt) {
    	Lease currentLease = getCurrentChosenLease();

    	if(currentLease != null){
    		String msg = "Really delete lease " + currentLease.getFormattedString() + "?";
        	String title = "Really delete lease?";
        	int reply = JOptionPane.showConfirmDialog(this, msg, title, JOptionPane.YES_NO_OPTION);
        	
        	if(reply == JOptionPane.YES_OPTION){
        		PropertiesManager.getInstance().removeLeaseFromDB(currentLease);
        		loadLeases();
        		loadTenants();
        		loadPayments();
        	}
    	}
    }

    private void btn_deleteTenantActionPerformed(java.awt.event.ActionEvent evt) {
    	Tenant currentTenant = getCurrentChosenTenant();
    	
    	if(currentTenant != null){
    		String msg = "Really delete tenant " + currentTenant.toString() + "?";
        	String title = "Really delete tenant?";
        	int reply = JOptionPane.showConfirmDialog(this, msg, title, JOptionPane.YES_NO_OPTION);
        	if(reply == JOptionPane.YES_OPTION){
        		PropertiesManager.getInstance().removeTenantFromDB(currentTenant);
        		loadLeases();
				loadTenants();
				loadPayments();
        	}
    	}
    }
    
    private void btn_deletePaymentActionPerformed(java.awt.event.ActionEvent evt) {
    	Payment currentPayment = getCurrentChosenPayment();
    	
    	if(currentPayment != null){
    		String msg = "Really delete payment " + currentPayment.toString() + "?";
    		String title = "Really delete payment?";
    		int reply = JOptionPane.showConfirmDialog(this, msg, title, JOptionPane.YES_NO_OPTION);
    		if(reply == JOptionPane.YES_OPTION){
    			Lease currentLease = getCurrentChosenLease();
    			
    			if(currentLease != null){
    				boolean success = currentLease.removePayment(currentPayment);
    				
    				if(success){
    					loadPayments();
    				}else {
    					System.err.println("Error deleting payment??");
    				}
    			}
    		}
    	}
    }
    
    private void btn_addTenantActionPerformed(java.awt.event.ActionEvent evt) {
    	Tenant selectedTenant = (Tenant) list_paymentTenants.getSelectedValue();
    	((DefaultListModel<Tenant>)list_associatedTenants.getModel()).addElement(selectedTenant);
    	((DefaultListModel<Tenant>)list_paymentTenants.getModel()).removeElement(selectedTenant);
    }
    
    private void btn_removeTenantActionPerformed(java.awt.event.ActionEvent evt) {
    	Tenant selectedTenant = (Tenant) list_associatedTenants.getSelectedValue();
    	((DefaultListModel<Tenant>)list_paymentTenants.getModel()).addElement(selectedTenant);
    	((DefaultListModel<Tenant>)list_associatedTenants.getModel()).removeElement(selectedTenant);
    }

    private void btn_savePropertyChangesActionPerformed(java.awt.event.ActionEvent evt) {
    	if(checkPropertyFields()){
    		Property currentProperty = getCurrentChosenProperty();
    		
    		if(currentProperty != null){
        		updateProperty(currentProperty);
        	}
        	
    		PropertiesManager.getInstance().saveDbState();
    		loadProperties();    		
    	}else {
    		JOptionPane.showMessageDialog(this,
    				"Required fields: Property Name, Property Address", "Invalid Inputs", JOptionPane.ERROR_MESSAGE);
    	}
    }

    private void btn_saveLeaseChangesActionPerformed(java.awt.event.ActionEvent evt) {
    	if(checkLeaseFields()){
	    	Lease currentLease = getCurrentChosenLease();
	    	
	    	if(currentLease != null){
	    		updateLease(currentLease);
	    	}
	    	
	    	PropertiesManager.getInstance().saveDbState();
    	}else {
    		JOptionPane.showMessageDialog(this,
    				"Required fields: Start Date, End Date, End Date >= Start Date, Deposit Amount, Rent Amount",
    				"Invalid Inputs", JOptionPane.ERROR_MESSAGE);
    	}
    }

    private void btn_saveTenantChangesActionPerformed(java.awt.event.ActionEvent evt) {
    	if(checkTenantFields()){
	    	Tenant currentTenant = getCurrentChosenTenant();
	    	
	    	if(currentTenant != null){
	    		updateTenant(currentTenant);
	    	}
	    	
	    	PropertiesManager.getInstance().saveDbState();
    	}else {
    		JOptionPane.showMessageDialog(this,
    				"Required fields: First Name, Last Name", "Invalid Inputs", JOptionPane.ERROR_MESSAGE);
    	}
    }
    
    private void btn_savePaymentChangesActionPerformed(java.awt.event.ActionEvent evt) {
    	if(checkPaymentFields()){
	    	Payment currentPayment = getCurrentChosenPayment();
	    	
	    	if(currentPayment != null){
		    	updatePayment(currentPayment);
	    	}
    	}else {
    		JOptionPane.showMessageDialog(this,
    				"Required fields: Date, Amount, at least one associated Tenant",
    				"Invalid Inputs", JOptionPane.ERROR_MESSAGE);
    	}
    	
    	PropertiesManager.getInstance().saveDbState();
    }
    
    private boolean checkPropertyFields(){
    	boolean valid = false;
    	
    	Property currentProperty = getCurrentChosenProperty();
		
		if(currentProperty != null){
			valid = !getPropertyName().isEmpty();
			valid &= !getPropertyAddress().isEmpty();
		}
		
		return valid;
    }
    
    private boolean checkLeaseFields(){
    	boolean valid = false;
    	
    	Lease currentLease = getCurrentChosenLease();
    	
    	if(currentLease != null){
    		valid = dc_leaseStartDate.getDate() != null;
    		valid &= dc_leaseEndDate.getDate() != null;
    		if(valid){
    			valid &= (dc_leaseStartDate.getDate().compareTo(dc_leaseEndDate.getDate()) <= 0);
    			valid &= !ftxt_depositAmt.getText().trim().isEmpty();
    			valid &= !ftxt_rentAmt.getText().trim().isEmpty();
    		}
    	}
    	
    	return valid;
    }
    
    private boolean checkTenantFields(){
    	boolean valid = false;
    	
    	Tenant currentTenant = getCurrentChosenTenant();
    	
    	if(currentTenant != null){
    		valid = !getFirstName().isEmpty();
    		valid &= !getLastName().isEmpty();
    	}
    	
    	return valid;
    }
    
    private boolean checkPaymentFields(){
    	boolean valid = false;
    	
    	Payment currentPayment = getCurrentChosenPayment();
    	
    	if(currentPayment != null){
    		valid = dc_dateReceived.getDate() != null;
    		valid &= !ftxt_amount.getText().trim().isEmpty();
    		valid &= ((DefaultListModel<Tenant>) list_associatedTenants.getModel()).getSize() != 0;
    	}
    	
    	return valid;
    }
    
    private void updateProperty(Property property){
    	if(property != null){
    		if(!getPropertyName().isEmpty()){
    			property.setPropertyName(getPropertyName());
    		}
    		
    		if(!getPropertyAddress().isEmpty()){
    			property.setPropertyAddress(getPropertyAddress());
    		}
    		
    		property.setSquareFeet(getSquareFeet());
    		property.setNumRooms(getNumRooms());
    		property.setNumBaths(getNumBaths());
    		property.setNumHalfBaths(getNumHalfBaths());
    		
    		if(!getExtraInfo().isEmpty()){
    			property.setExtraInfo(getExtraInfo());
    		}
    	}
    }
    
    private void updateLease(Lease lease){
    	if(lease != null){
    		if(dc_leaseStartDate.getDate() != null){
    			lease.setLeaseStartDate(dc_leaseStartDate.getDate());
    		}
    		
    		if(dc_leaseEndDate.getDate() != null){
    			lease.setLeaseEndDate(dc_leaseEndDate.getDate());
    		}
    		
    		lease.setDepositAmount(getDepositAmount());
    		lease.setRentAmount(getRentAmount());
    		lease.setRentDueDate(getRentDueDate());
    		lease.setRentLateDate(getRentLateDate());
    		lease.setLateRentFee(getLateRentFee());
    		lease.setLateRentFeePerDay(getLateRentFeePerDay());
    		lease.setPetsAllowed(isPetsAllowed());
    		if(isPetsAllowed()){
    			lease.setPetDepositFee(getPetDepositFee());
    			lease.setPetDepositRefundable(isPetDepositRefundable());
    		}
    	}
    }
    
    private void updateTenant(Tenant tenant){
    	if(tenant != null){
    		if(!getFirstName().isEmpty()){
    			tenant.setFirstName(getFirstName());
    		}
    		
    		if(!getLastName().isEmpty()){
    			tenant.setLastName(getLastName());
    		}
    		
    		tenant.setTenantAge(getAge());
    	}
    }
    
    private void updatePayment(Payment payment){
    	if(payment != null){
    		payment.setType(getPaymentType());
    		
    		if(!getPaymentName().isEmpty()){
    			payment.setPaymentName(getPaymentName());
    		}
    		
    		payment.setAmount(getAmount());
    		payment.setDateReceived(getDateReceived());
    		payment.setAssociatedTenants(getAssociatedTenants());
    	}
    }
    
    private void clearProperties(){
    	((DefaultListModel<Property>) list_properties.getModel()).clear();
    }
    
    private void clearPropertiesFields(){
    	txt_propertyName.setText(null);
    	txt_propertyAddress.setText(null);
    	ftxt_squareFeet.setText(null);
    	ftxt_numRooms.setText(null);
    	ftxt_numBaths.setText(null);
    	ftxt_numHalfBaths.setText(null);
    	jtxt_extraInfo.setText(null);
    }
    
    private void clearLeases(){
    	((DefaultListModel<Lease>) list_leases.getModel()).clear();
    }

	private void clearTenants() {
		((DefaultListModel<Tenant>) list_tenants.getModel()).clear();
	}
	
	private void clearPaymentTenants(){
		((DefaultListModel<Tenant>) list_paymentTenants.getModel()).clear();
	}
	
	private void clearPaymentAssociatedTenants(){
		((DefaultListModel<Tenant>) list_associatedTenants.getModel()).clear();
	}

	private void clearPayments() {
		((DefaultListModel<Payment>) list_payments.getModel()).clear();
	}
	
	private void clearTenantFields(){
		txt_firstName.setText(null);
    	txt_lastName.setText(null);
    	ftxt_age.setText(null);
	}
	
	private void clearLeaseFields(){
    	dc_leaseStartDate.setDate(null);
    	dc_leaseEndDate.setDate(null);
    	ftxt_depositAmt.setText(null);
    	ftxt_rentAmt.setText(null);
    	spn_rentDueDate.setValue(0);
    	spn_rentLateDate.setValue(0);
    	ftxt_lateRentFee.setText(null);
    	ftxt_lateRentFeePerDay.setText(null);
    	chk_petsAllowed.setSelected(false);
    	jLabel15.setEnabled(false);
    	ftxt_petDepositAmt.setEnabled(false);
    	chk_petDepositRefundable.setEnabled(false);
    	ftxt_petDepositAmt.setText(null);
    	chk_petDepositRefundable.setSelected(false);
	}
	
	private void clearPaymentFields(){
		cmbo_paymentType.setSelectedIndex(0);
    	
    	txt_paymentName.setText(null);
    	ftxt_amount.setText(null);
    	dc_dateReceived.setDate(null);
    	
    	clearPaymentAssociatedTenants();
    	clearPaymentTenants();
	}
    
    private void loadProperties(){
    	clearProperties();
    	clearPropertiesFields();
    	List<Property> allProperties = PropertiesManager.getInstance().getAllProperties();
    	
    	if(allProperties != null && allProperties.size() != 0){
    		for(Property property : allProperties){
    			((DefaultListModel<Property>) list_properties.getModel()).addElement(property);
    		}
    	}else {
    		tabbedPane.setEnabledAt(1, false);
    		tabbedPane.setEnabledAt(2, false);
    		tabbedPane.setEnabledAt(3, false);
    	}
    	
    	list_properties.setSelectedIndex(0);
    }

    private Property getCurrentChosenProperty(){
    	Object selectedValue = list_properties.getSelectedValue();
    	
    	if(selectedValue != null){
    		return (Property) selectedValue;
    	}
    	
    	return null;
    }
    
    private Lease getCurrentChosenLease(){
    	Object selectedValue = list_leases.getSelectedValue();
    	
    	if(selectedValue != null){
    		return (Lease) selectedValue;
    	}
    	
    	return null;
    }
    
    private Tenant getCurrentChosenTenant(){
    	Object selectedValue = list_tenants.getSelectedValue();
    	
    	if(selectedValue != null){
    		return (Tenant) selectedValue;
    	}
    	
    	return null;
    }
    
    private Payment getCurrentChosenPayment(){
    	Object selectedValue = list_payments.getSelectedValue();
    	
    	if(selectedValue != null){
    		return (Payment) selectedValue;
    	}
    	
    	return null;
    }
    
    private void loadPropertyFields(){
    	Property currentProperty = getCurrentChosenProperty();
    	
    	if(currentProperty != null){
	    	txt_propertyName.setText(currentProperty.getPropertyName());
	    	txt_propertyAddress.setText(currentProperty.getPropertyAddress());
	    	ftxt_squareFeet.setText(String.valueOf(currentProperty.getSquareFeet()));
	    	ftxt_numRooms.setText(String.valueOf(currentProperty.getNumRooms()));
	    	ftxt_numBaths.setText(String.valueOf(currentProperty.getNumBaths()));
	    	ftxt_numHalfBaths.setText(String.valueOf(currentProperty.getNumHalfBaths()));
	    	jtxt_extraInfo.setText(currentProperty.getExtraInfo());
    	}
    }
    
    private void loadLeases(){
    	Property currentProperty = getCurrentChosenProperty();
    	
    	if(currentProperty != null){
    		clearLeases();
    		clearLeaseFields();
    		if(currentProperty.getLeases().size() > 0){
		    	for(Lease lease : currentProperty.getLeases()){
		    		((DefaultListModel<Lease>) list_leases.getModel()).addElement(lease);
		    	}
    		}else {
    			tabbedPane.setEnabledAt(1, false);
    			tabbedPane.setEnabledAt(2, false);
    			tabbedPane.setEnabledAt(3, false);
    		}
    		
    		list_leases.setSelectedIndex(0);
    	}
    }
    
    private void loadPaymentFields(){
    	Lease currentLease = getCurrentChosenLease();
    	
    	if(currentLease != null){
	    	Payment selection = (Payment) list_payments.getSelectedValue();
	    	for(Payment payment : currentLease.getPayments()){
	    		if(payment.equals(selection)){
	    	    	cmbo_paymentType.setSelectedIndex(payment.getType().ordinal());
	    	    	
	    	    	txt_paymentName.setText(payment.getPaymentName());
	    	    	ftxt_amount.setText(String.valueOf(payment.getAmount()));
	    	    	dc_dateReceived.setDate(payment.getDateReceived());
	    	    	if(payment.getType().equals(PaymentType.RENT)){
	    	    		rentMonthChooser.setMonth(payment.getRentPaymentMonth());
	    	    		cmbo_rentYear.setSelectedItem(payment.getRentPaymentYear());
	    	    	}
//	    	    	dc_dateReceived.setMinSelectableDate(currentLease.getLeaseStartDate());
//	    	    	dc_dateReceived.setMaxSelectableDate(currentLease.getLeaseEndDate());
	    	    	
	    	    	for(Tenant tenant : payment.getAssociatedTenants()){
	    	    		((DefaultListModel<Tenant>)list_associatedTenants.getModel()).addElement(tenant);
	    	    		((DefaultListModel<Tenant>)list_paymentTenants.getModel()).removeElement(tenant);
	    	    	}
	    			break;
	    		}
	    	}
    	}
    }
    
    private void loadTenants(){
    	Lease currentLease = getCurrentChosenLease();
    	
    	if(currentLease != null){
    		clearTenants();
    		clearTenantFields();
    		
    		for(Tenant tenant : currentLease.getTenants()){
    			((DefaultListModel<Tenant>) list_tenants.getModel()).addElement(tenant);
    			
    			if(currentLease.getPayments().size() > 0){
    				((DefaultListModel<Tenant>)list_paymentTenants.getModel()).addElement(tenant);
    			}
    		}
    		
    		list_tenants.setSelectedIndex(0);
    	}
    }
    
    private void loadPayments(){
    	Lease currentLease = getCurrentChosenLease();
    	
    	if(currentLease != null){
    		clearPayments();
    		clearPaymentFields();
    		
    		tabbedPane.setEnabledAt(3, currentLease.getPayments().size() != 0);
    		
    		for(Payment payment : currentLease.getPayments()){
    			((DefaultListModel<Payment>) list_payments.getModel()).addElement(payment);
    		}
    		
    		list_payments.setSelectedIndex(0);
    	}
    }

 // Variables declaration - do not modify
    private javax.swing.JButton btn_addTenant;
    private javax.swing.JButton btn_close;
    private javax.swing.JButton btn_deleteLease;
    private javax.swing.JButton btn_deletePayment;
    private javax.swing.JButton btn_deleteProperty;
    private javax.swing.JButton btn_deleteTenant;
    private javax.swing.JButton btn_removeTenant;
    private javax.swing.JButton btn_saveLeaseChanges;
    private javax.swing.JButton btn_savePaymentChanges;
    private javax.swing.JButton btn_savePropertyChanges;
    private javax.swing.JButton btn_saveTenantChanges;
    private javax.swing.JCheckBox chk_petDepositRefundable;
    private javax.swing.JCheckBox chk_petsAllowed;
    private javax.swing.JComboBox<Integer> cmbo_rentYear;
    private javax.swing.JComboBox<PaymentType> cmbo_paymentType;
    private com.toedter.calendar.JDateChooser dc_dateReceived;
    private com.toedter.calendar.JDateChooser dc_leaseEndDate;
    private com.toedter.calendar.JDateChooser dc_leaseStartDate;
    private javax.swing.JFormattedTextField ftxt_age;
    private javax.swing.JFormattedTextField ftxt_amount;
    private javax.swing.JFormattedTextField ftxt_depositAmt;
    private javax.swing.JFormattedTextField ftxt_lateRentFee;
    private javax.swing.JFormattedTextField ftxt_lateRentFeePerDay;
    private javax.swing.JFormattedTextField ftxt_numBaths;
    private javax.swing.JFormattedTextField ftxt_numHalfBaths;
    private javax.swing.JFormattedTextField ftxt_numRooms;
    private javax.swing.JFormattedTextField ftxt_petDepositAmt;
    private javax.swing.JFormattedTextField ftxt_rentAmt;
    private javax.swing.JFormattedTextField ftxt_squareFeet;
    private javax.swing.JButton btn_createNewTenant;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JTextArea jtxt_extraInfo;
    private javax.swing.JList<Tenant> list_associatedTenants;
    private javax.swing.JList<Lease> list_leases;
    private javax.swing.JList<Tenant> list_paymentTenants;
    private javax.swing.JList<Payment> list_payments;
    private javax.swing.JList<Property> list_properties;
    private javax.swing.JList<Tenant> list_tenants;
    private javax.swing.JSpinner spn_rentDueDate;
    private javax.swing.JSpinner spn_rentLateDate;
    private javax.swing.JTabbedPane tabbedPane;
    private javax.swing.JTextField txt_firstName;
    private javax.swing.JTextField txt_lastName;
    private javax.swing.JFormattedTextField txt_newTenantAge;
    private javax.swing.JTextField txt_newTenantFirstName;
    private javax.swing.JTextField txt_newTenantLastName;
    private javax.swing.JTextField txt_paymentName;
    private javax.swing.JTextField txt_propertyAddress;
    private javax.swing.JTextField txt_propertyName;
    private com.toedter.calendar.JMonthChooser rentMonthChooser;
    // End of variables declaration
}